//
//  SystemEmployerCell.m
//  ForestPack
//
//  Created by jimmy on 2018/7/24.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "SystemEmployerCell.h"
#import "Masonry.h"

@implementation SystemEmployerCell

+(SystemEmployerCell *)cellWithTableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPat
{
    static NSString *cellID = @"SystemEmployerCell";
    SystemEmployerCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[SystemEmployerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell creatViewUI];
    }
    return cell;
}

-(void)contactClicked
{
    if (_contactClick) {
        _contactClick();
    }
}

-(void)finishClicked
{
    if (_finishClick) {
        _finishClick();
    }
}

-(void)creatViewUI
{
    UIImageView * headImageV = [[UIImageView alloc] init];
    headImageV.image = [UIImage imageNamed:@"头部背景"];
    headImageV.layer.masksToBounds = YES;
    headImageV.layer.cornerRadius = 24;
    [self addSubview:headImageV];
    [headImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(13);
        make.top.equalTo(self.mas_top).offset(15);
        make.width.equalTo(@48);
        make.height.equalTo(@48);
    }];
    
    UILabel *nameLabel = [[UILabel alloc] init];
    nameLabel.text = @"昵称";
    nameLabel.textColor = FONTCOLOR_BLACK;
    nameLabel.textAlignment = NSTextAlignmentLeft;
    nameLabel.font = Kfont(14);
    [self addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(headImageV.mas_right).offset(5);
        make.top.equalTo(self.mas_top).offset(15);
        make.width.equalTo(@40);
        make.height.equalTo(@20);
    }];
    
    UILabel *nickLabel = [[UILabel alloc] init];
    nickLabel.text = @"我是谁谁谁";
    nickLabel.textColor = RGB_COLOR(153, 153, 153);
    nickLabel.textAlignment = NSTextAlignmentLeft;
    nickLabel.font = Kfont(12);
    [self addSubview:nickLabel];
    [nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(headImageV.mas_right).offset(5);
        make.top.equalTo(nameLabel.mas_bottom).offset(5);
        make.width.equalTo(@(SCREEN_WIDTH - 173));
        make.height.equalTo(@20);
    }];
    
    UIButton *contactBtn = [[UIButton alloc] init];
    [contactBtn setBackgroundImage:[UIImage imageNamed:@"发消息2"] forState:UIControlStateNormal];
    [contactBtn addTarget:self action:@selector(contactClicked) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:contactBtn];
    [contactBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-13);
        make.top.equalTo(self.mas_top).offset(28);
        make.width.equalTo(@22);
        make.height.equalTo(@22);
    }];
    
    self.finishBtn = [[OperateButton alloc] init];
    self.finishBtn.layer.masksToBounds = YES;
    self.finishBtn.layer.cornerRadius = 22;
    [self.finishBtn setTitle:@"已完成" forState:UIControlStateNormal];
    [self.finishBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.finishBtn.backgroundColor = RGB_COLOR(237,34,59);
    [self.finishBtn addTarget:self action:@selector(finishClicked) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.finishBtn];
    [self.finishBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(13);
        make.top.equalTo(headImageV.mas_bottom).offset(50);
        make.width.equalTo(@(SCREEN_WIDTH - 26));
        make.height.equalTo(@44);
    }];
    
}

@end


@implementation SystemDesignerCell




@end
